<template>
	<div class="table-mechanism">
<!--    <div class="tableHeader">-->
<!--      <el-input style="width: 200px; margin-right: 20px;" @change="search()" v-model.trim="queryForm.elderlyCode" autocomplete="off" placeholder="请输入入住人编号或姓名"></el-input>-->
<!--      <el-date-picker-->
<!--        v-model="checkedInTime"-->
<!--        @change="val => { queryForm.checkedInTimeStart = val && val[0]; queryForm.checkedInTimeEnd = val && val[1]; search() }"-->
<!--        type="daterange"-->
<!--        range-separator="至"-->
<!--        start-placeholder="入住开始日期"-->
<!--        end-placeholder="入住结束日期">-->
<!--      </el-date-picker>-->
<!--    </div>-->
<!--    <el-container style="height: 500px; border: 1px solid #eee">-->
<!--      <el-aside width="420px" style="background-color: #ffffff">-->
<!--        <el-table :data="list" v-loading="listLoading">-->
<!--          &lt;!&ndash;			<el-table-column show-overflow-tooltip="" min-width="100" label="入住编号" prop="checkInMark"></el-table-column>&ndash;&gt;-->
<!--          &lt;!&ndash;          <el-table-column show-overflow-tooltip="" min-width="150" label="老人编号" prop="elderlyCode"></el-table-column>&ndash;&gt;-->
<!--          <el-table-column prop="elderlyName" label="老人姓名" width="80"></el-table-column>-->
<!--          &lt;!&ndash;			<el-table-column label="入住日期" min-width="120">&ndash;&gt;-->
<!--          &lt;!&ndash;				<template slot-scope="scope">&ndash;&gt;-->
<!--          &lt;!&ndash;						{{scope.row.checkedInTime | parseTime('{y}-{m}-{d}')}}&ndash;&gt;-->
<!--          &lt;!&ndash;				</template>&ndash;&gt;-->
<!--          &lt;!&ndash;			</el-table-column>&ndash;&gt;-->
<!--          <el-table-column label="床位地址" width="120">-->
<!--            <template slot-scope="scope">-->
<!--              {{ scope.row.buildingNumber }}-{{ scope.row.floor }}-{{ scope.row.unit }}-{{ scope.row.roomNumber }}-->
<!--            </template>-->
<!--          </el-table-column>-->
<!--          <el-table-column label="护理级别" width="80px" prop="nursingLevelName"></el-table-column>-->
<!--          &lt;!&ndash;			<el-table-column min-width="160px" label="备注" prop="remark"></el-table-column>&ndash;&gt;-->
<!--          <el-table-column label="操作" prop="disabled" width="120px" fixed="right">-->
<!--            <template slot-scope="scope">-->
<!--              <el-button type="text" @click="planVisible = true; activeRow = scope.row; getPlanlist()">-->
<!--                护理计划-->
<!--              </el-button>-->
<!--&lt;!&ndash;              <el-button type="text" @click="carelistVisible = true; activeRow = scope.row; getCarelist()">&ndash;&gt;-->
<!--&lt;!&ndash;                护理清单&ndash;&gt;-->
<!--&lt;!&ndash;              </el-button>&ndash;&gt;-->
<!--            </template>-->
<!--          </el-table-column>-->
<!--        </el-table>-->
<!--            <el-pagination-->
<!--              :background="background"-->
<!--              :current-page=queryForm.currPageNo-->
<!--              :total="total"-->
<!--              :page-size="queryForm.limit"-->
<!--              @current-change="handleCurrentChange"-->
<!--              @size-change="handleSizeChange"-->
<!--            ></el-pagination>-->
<!--      </el-aside>-->

<!--      <el-container>-->
<!--        <el-header style="text-align: right; height:20px;font-size: 12px">-->
<!--          <el-dropdown>-->
<!--            <div class="header">-->
<!--              <el-date-picker-->
<!--                v-model="carelistTime"-->
<!--                value-format="yyyy-MM-dd"-->
<!--                type="date"-->
<!--                style="margin-right: 10px;"-->
<!--                @change="getCarelist()"-->
<!--                placeholder="请选择日期">-->
<!--              </el-date-picker>-->
<!--              <el-button @click="generateCareListOfCheckIn">生成计划护理清单</el-button>-->
<!--              <el-button @click="openCareListItem(); addCareListItemVisible = true">添加临时护理内容</el-button>-->
<!--            </div>-->
<!--          </el-dropdown>-->

<!--        </el-header>-->

<!--        <el-main>-->


<!--          <div class="planlist">-->
<!--            <el-table-->
<!--              :data="carelist"-->
<!--              v-loading="carelistLoading"-->
<!--              :row-class-name="tableRowClassName"-->
<!--            >-->
<!--              <el-table-column-->
<!--                prop="nursingItemName"-->
<!--                label="项目名称"-->
<!--              ></el-table-column>-->
<!--              <el-table-column-->
<!--                width="130px"-->
<!--                prop="careTypeName"-->
<!--                label="项目类型"-->
<!--              ></el-table-column>-->
<!--              <el-table-column-->
<!--                prop="execPrice"-->
<!--                label="执行价格"-->
<!--              ></el-table-column>-->
<!--              <el-table-column  label="计划执行日期"  width="150">-->
<!--                <template slot-scope="scope">-->
<!--                  {{scope.row.listTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}-->
<!--                </template>-->
<!--              </el-table-column>-->
<!--              <el-table-column  label="状态">-->
<!--                <template slot-scope="scope">-->
<!--                  <span v-if="scope.row.disabled">已撤销</span>-->
<!--                  <span v-if="scope.row.executionedTime">已执行</span>-->
<!--                </template>-->
<!--              </el-table-column>-->
<!--              <el-table-column-->
<!--                prop="executorName"-->
<!--                label="执行人"-->
<!--              ></el-table-column>-->
<!--              <el-table-column  label="执行开始时间"  width="180">-->
<!--                <template slot-scope="scope" v-if="scope.row.actualExecutionTime">-->
<!--                  {{scope.row.actualExecutionTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}-->
<!--                </template>-->
<!--              </el-table-column>-->
<!--              <el-table-column  label="执行结束时间"  width="180">-->
<!--                <template slot-scope="scope" v-if="scope.row.executionedTime">-->
<!--                  {{scope.row.executionedTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}-->
<!--                </template>-->
<!--              </el-table-column>-->
<!--              <el-table-column-->
<!--                prop="execRemark"-->
<!--                label="执行备注"-->
<!--              ></el-table-column>-->
<!--              <el-table-column label="操作" prop="disabled"  width="120px"  fixed="right">-->
<!--                <template slot-scope="scope" v-if="!scope.row.executionedTime">-->
<!--                  <el-button v-if="!scope.row.disabled" type="text" @click="submitCareListVisible = true; activeCareListItem = scope.row,carray(scope.row)">执行</el-button>-->
<!--                  <el-button v-if="!scope.row.disabled" type="text" @click="delCareList(scope.row)">撤销</el-button>-->
<!--                </template>-->
<!--              </el-table-column>-->
<!--            </el-table>-->

<!--            &lt;!&ndash; <el-pagination-->
<!--              :background="background"-->
<!--              :current-page=planQueryForm.currPageNo-->
<!--              :total="planTotal"-->
<!--              :page-size="planQueryForm.limit"-->
<!--              @current-change="planHandleCurrentChange"-->
<!--              @size-change="planHandleSizeChange"-->
<!--            ></el-pagination> &ndash;&gt;-->
<!--          </div>-->
<!--        </el-main>-->
<!--      </el-container>-->
<!--    </el-container>-->

    <div class="treeTable">
      <div class="menuBox">
<!--            <div class="tableHeader">-->
<!--              <el-input style="width: 200px; margin-right: 20px;" @change="search()" v-model.trim="queryForm.elderlyCode" autocomplete="off" placeholder="请输入入住人编号或姓名"></el-input>-->
<!--              <el-date-picker-->
<!--                v-model="checkedInTime"-->
<!--                @change="val => { queryForm.checkedInTimeStart = val && val[0]; queryForm.checkedInTimeEnd = val && val[1]; search() }"-->
<!--                type="daterange"-->
<!--                range-separator="至"-->
<!--                start-placeholder="入住开始日期"-->
<!--                end-placeholder="入住结束日期">-->
<!--              </el-date-picker>-->
<!--            </div>-->
        <div  class="screen">
          <div class="el-select el-select--mini" style="float: right;width: 35%;margin-left: 2px">
            <div class="el-input el-input--mini el-input--suffix" >
              <el-input  @change="search(0,'')" v-model.trim="queryForm.elderlyCode" autocomplete="off" placeholder="入住人编号/姓名"></el-input>


            </div>
          </div>
          <div class="el-date--mini" style="width: 65%">
            <el-date-picker
              unlink-panels
                              size="mini"
                             style="width: 80%"
                              v-model="checkedInTime"
                              @change="val => { queryForm.checkedInTimeStart = val && val[0]; queryForm.checkedInTimeEnd = val && val[1]; search(0,'') }"
                              type="daterange"
                              range-separator="至"
                              start-placeholder="入住开始日期"
                              end-placeholder="入住结束日期">
                            </el-date-picker>
          </div>
          <div style="margin-top: 12px;">
            <el-select v-model="queryForm.checkedInStatus"
                       size="mini"
                       @change="val => {  search(1,'') }"

                       style="width: 52%;" placeholder="请选择">
              <el-option
                v-for="item in checkedInStatuss"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>

          </div>
        </div>
        <el-button-group>
<!--          <div class="tableHeader">-->
<!--            <el-input style="width: 100px; margin-right: 20px;" @change="search()" v-model.trim="queryForm.elderlyCode" autocomplete="off" placeholder="请输入入住人编号或姓名"></el-input>-->
<!--            <el-date-picker-->
<!--              v-model="checkedInTime"-->
<!--              @change="val => { queryForm.checkedInTimeStart = val && val[0]; queryForm.checkedInTimeEnd = val && val[1]; search() }"-->
<!--              type="daterange"-->
<!--              range-separator="至"-->
<!--              start-placeholder="入住开始日期"-->
<!--              end-placeholder="入住结束日期">-->
<!--            </el-date-picker>-->
<!--          </div>-->
        </el-button-group>
        <div class="listNull" v-if="list==null" style="text-align: center;
    color: #909399;
    font-size: 12px;
    line-height: 400px;
">暂无数据</div>

        <ul  style=""  v-if="list">



          <li :class="{ 'active': index == showIndex }" v-for="(item, index) in list" @click="showIndex = index; activeRow = item; getList(item)" >

            <b>{{ item.elderlyName }}</b>
            <b class="prewidth">{{ item.checkInBed }}</b>
            <b >{{ item.nursingLevelName }}</b>
            <el-button type="primary" plain @click="planVisible = true; activeRow = item; getPlanlist()">
                              护理计划
                            </el-button>
<!--            <el-button type="text" @click="carelistVisible = true; activeRow = item; getCarelist()">-->
<!--                             护理清单-->
<!--                          </el-button>-->
          </li>
        </ul>
        <el-pagination
          small

          :current-page=queryForm.currPageNo
          :total="total"
          :page-size="queryForm.limit"
          @current-change="handleCurrentChange"
          @size-change="handleSizeChange"
        ></el-pagination>
      </div>

      <div class="tableBox" >
        <div class="userInfo">
          <div class="header" v-if="showIndex!=-1&&list!=null">
<!--            <el-date-picker-->
<!--              v-model="carelistTime"-->
<!--              value-format="yyyy-MM-dd"-->
<!--              type="date"-->
<!--              style="margin-right: 10px;"-->
<!--              @change="getCarelist()"-->
<!--              placeholder="请选择日期">-->
<!--            </el-date-picker>-->

            <el-date-picker
              v-model="listTime"
              type="daterange"
              :unlink-panels="true"
              :picker-options="pickerOptions"
              range-separator="至"
              style="margin-right: 10px;"
              size="mini"
              @change="val => { listForm.listTimeStart = val && val[0]; listForm.listTimeEnd = val && val[1]; searchDailyCareListByListTime(0,'') }"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              align="right">
            </el-date-picker>
            <el-button size="mini" style="float: right;margin-left: 20px" @click="digsubmitoperation = true; akeyperformCare(1)">一键执行</el-button>

            <el-button style="float: right;margin-left: 20px" size="mini" @click="openCareListItem(); addCareListItemVisible = true">添加临时护理内容</el-button>

            <el-button  size="mini" @click="openListOfCheckIn" style="float: right">生成计划护理清单</el-button>
          </div>
        </div>

        <div class="planlist">
          <el-table
            :data="carelist"
            height="calc(100vh - 390px)"
            v-loading="carelistLoading"
            :row-class-name="tableRowClassName"
          >
            <el-table-column
              prop="nursingItemName"
              label="项目名称"
            ></el-table-column>
            <el-table-column
              width="130px"
              prop="careTypeName"
              label="项目类型"
            ></el-table-column>
            <el-table-column
              prop="execPrice"
              label="执行价格"
            ></el-table-column>
            <el-table-column  label="计划执行日期"  width="150">
              <template slot-scope="scope">
                {{scope.row.planExecutionTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}
              </template>
            </el-table-column>
            <el-table-column  label="状态">
              <template slot-scope="scope">
                <span v-if="scope.row.disabled">已撤销</span>
                <span v-if="scope.row.executionedTime">已执行</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="executorName"
              label="执行人"
            ></el-table-column>
            <el-table-column  label="执行开始时间"  width="180">
              <template slot-scope="scope" v-if="scope.row.actualExecutionTime">
                {{scope.row.actualExecutionTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}
              </template>
            </el-table-column>
            <el-table-column  label="执行结束时间"  width="180">
              <template slot-scope="scope" v-if="scope.row.executionedTime">
                {{scope.row.executionedTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}
              </template>
            </el-table-column>
            <el-table-column
              prop="execRemark"
              label="执行备注"
            ></el-table-column>
            <el-table-column label="操作" prop="disabled"  width="120px"  fixed="right">
              <template slot-scope="scope" >
                <el-button v-if="!scope.row.disabled&&!scope.row.executionedTime" type="text" @click="submitCareListVisible = true; activeCareListItem = scope.row,carray(scope.row)">执行</el-button>
                <el-button v-if="!scope.row.disabled&&!scope.row.executionedTime" type="text" @click="delCareList(scope.row)">撤销</el-button>
                <el-button v-if="scope.row.executionedTime" type="text"  @click="dialoginfo = true;searchinfo(scope.row)">详情</el-button>

              </template>


            </el-table-column>
          </el-table>

          <el-pagination
            :background="background"
            :current-page=listForm.currPageNo
            :total="listTotal"
            :page-size="listForm.limit"
            @current-change="listHandleCurrentChange"
            @size-change="listHandleSizeChange"
          ></el-pagination>
        </div>
      </div>
    </div>
		<el-dialog
			title="护理计划"
			:visible.sync="planVisible"
			width="70%"
		>
			<!-- <div class="header" v-if="!planlist.length"> -->
			<div class="header">
        <el-button @click="addPlanVisible = true; planIsEdit = false">添加护理计划</el-button>
          <el-button @click="PlanTemplateOfConditions" >模板生成护理计划</el-button>
			</div>
			<br>
			<div class="planlist">
				<el-table
					:data="planlist"
					v-loading="planlistLoading"
          default-expand-all

        >
          <el-table-column type="expand">
            <template slot-scope="scope">
            <el-table
              :data="scope.row.items"
              v-loading="projectlistLoading"
            >
              <el-table-column
                show-overflow-tooltip
                label="项目名称"
                prop="nursingItemName"
              ></el-table-column>
              <el-table-column label="是否收费">
                <template slot-scope="scope">
                  {{ scope.row.charge ? '是' : '否'}}
                </template>
              </el-table-column>
              <el-table-column label="执行费用">
                <template slot-scope="scope">
                  {{ scope.row.price }}
                </template>
              </el-table-column>
              <el-table-column label="执行周期">
                <template slot-scope="scope">
                  {{ scope.row.unit == 2 ? '月' : '天'}}
                </template>
              </el-table-column>
              <el-table-column
                show-overflow-tooltip
                label="执行周期间隔"
                width="120"
                prop="cycle"
              ></el-table-column>

<!--              <el-table-column label="周期内执行时间"  width="120">-->
<!--                <template slot-scope="scope" v-if="scope.row.executionTimes">-->
<!--                  <div v-for="(item, index) in scope.row.executionTimes" class="timeBox">-->
<!--                    <template v-if="scope.row.unit == 2">-->
<!--                      <span>{{item.d}}</span>日-->
<!--                    </template>-->
<!--                    <span>{{item.h}}</span>时-->
<!--                    <span>{{item.m}}</span>分-->
<!--                  </div>-->
<!--                </template>-->

<!--              </el-table-column>-->
              <el-table-column label="计划开始时间"  width="180">
                <template slot-scope="scope" v-if="scope.row.startExecTime">
                  {{ scope.row.startExecTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}') }}
                </template>
              </el-table-column>
              <el-table-column label="终止时间"  width="180">
                <template slot-scope="scope" v-if="scope.row.expirationDate">
                  {{ scope.row.expirationDate | parseTime('{y}-{m}-{d} {h}:{i}:{s}') }}
                </template>
              </el-table-column>
              <el-table-column label="操作" prop="disabled"  width="120px"  fixed="right">
                <template slot-scope="scope">
                  <!-- <el-button type="text" @click="planVisible = true">套餐项目</el-button>
                  <el-button type="text">套餐外项目</el-button>
                  <el-button type="danger" @click="enablePlan(id, scope.row.state)">禁用</el-button> -->
                  <el-button type="text" @click="editProject({ ...scope.row })">编辑</el-button>
                  <el-button type="text" v-if="!scope.row.disabled" @click="enableProject(false, { ...scope.row })">禁用</el-button>
                  <el-button type="text" v-else @click="enableProject(true, { ...scope.row })">启用</el-button>
                </template>
              </el-table-column>
            </el-table>
            </template>
          </el-table-column>

					<el-table-column
						prop="planName"
						label="计划名称"
					></el-table-column>
					<el-table-column  label="执行日期"  width="150">
						<template slot-scope="scope">
							{{scope.row.startDate | parseTime('{y}-{m}-{d}')}}
						</template>
					</el-table-column>
					<el-table-column  label="终止日期"  width="150">
						<template slot-scope="scope">
							<span v-if="scope.row.expirationDate">{{scope.row.expirationDate | parseTime('{y}-{m}-{d}')}}</span>
						</template>
					</el-table-column>
					<el-table-column  label="状态">
						<template slot-scope="scope">
							{{scope.row.disabled ? '禁用' : '启用' }}
						</template>
					</el-table-column>
					<el-table-column label="操作" prop="disabled"  width="500px"  fixed="right">
						<template slot-scope="scope">
							<el-button type="text" @click="addPlanVisible = true; planIsEdit = true; addPlanform = {...scope.row};">编辑</el-button>
<!--							<el-button type="text" @click="projectVisible = true; activePlanRow = scope.row; getProjectlist(1)">护理项目</el-button>-->
              <el-button type="text" @click="searchProjectInside();activePlanRow = scope.row;">添加套餐护理项目</el-button>
<!--              <el-button  type="text" @click="openProject();activePlanRow = scope.row;">添加套餐外护理项目</el-button>-->
							<!-- <el-button type="text" @click="projectVisible = true; activePlanRow = scope.row; getProjectlist(2)">套餐外项目</el-button> -->
							 <el-button type="text" v-if="!scope.row.disabled" @click="enablePlan(scope.row.planNumber, scope.row.disabled)">禁用</el-button>
							<el-button type="text" v-else @click="enablePlan(scope.row.planNumber, scope.row.disabled)">启用</el-button>
							<el-button type="text" @click="delPlan(scope.row.planNumber)">删除</el-button>
						</template>
					</el-table-column>
				</el-table>

				<el-pagination
					:background="background"
					:current-page=planQueryForm.currPageNo
					:total="planTotal"
					:page-size="planQueryForm.limit"
					@current-change="planHandleCurrentChange"
					@size-change="planHandleSizeChange"
				></el-pagination>
			</div>
		</el-dialog>
    <el-dialog
      title="执行详情"
      :visible.sync="dialoginfo"
      width="1000px"

    >
      <table style="width: 100%" class="mytable">
        <tr>
          <td class="ttitle" rowspan="4">护理记录</td>
          <td class="ttitle">项目名称</td>
          <td>{{info.nursingItemName}}</td>
          <td class="ttitle">项目类型</td>
          <td>{{info.careTypeName}}</td>
          <td class="ttitle">执行价格</td>
          <td style="min-width: 23px">{{info.execPrice}}</td>
        </tr>
        <tr>
          <td class="ttitle">计划执行时间</td>
          <td>{{info.planExecutionTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}</td>
          <td class="ttitle">执行人</td>
          <td >{{info.executorName}}</td>
          <td class="ttitle">执行开始时间</td>
          <td>
            {{info.actualExecutionTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}
          </td>
        </tr>
        <tr>
          <td class="ttitle">执行结束时间</td>
          <td>{{info.executionedTime |parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}

          </td>
          <td class="ttitle">皮肤状况</td>
          <td >{{info.skinConditionName}}</td>
          <td class="ttitle">卧位</td>
          <td >{{info.lyingPositionName}}</td>
        </tr>
        <tr>
          <td class="ttitle">执行备注</td>
          <td colspan="6">
            {{info.execRemark}}
          </td>

        </tr>
      </table>
    </el-dialog>
		<el-dialog
			:title="planIsEdit ? '修改护理计划' : '添加护理计划'"
			:visible.sync="addPlanVisible"
			width="500px"
		>
			<el-form ref="addPlanform" :model="addPlanform" :rules="planRules" label-width="120px" >
				<el-form-item label="计划名称" prop="planName">
					<el-input v-model.trim="addPlanform.planName" autocomplete="off"></el-input>
				</el-form-item>
				<el-form-item label="执行日期" prop="startDate">
					<el-date-picker
						v-model="addPlanform.startDate"
						type="date"
						value-format="yyyy-MM-dd"
						placeholder="选择日期">
					</el-date-picker>
				</el-form-item>
				<el-form-item label="终止日期">
					<el-date-picker
						v-model="addPlanform.expirationDate"
						type="date"
						value-format="yyyy-MM-dd"
						placeholder="选择日期">
					</el-date-picker>
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="addPlanVisible = false" >取 消</el-button>
				<el-button type="primary" @click="savePlan">确 定</el-button>
			</div>
		</el-dialog>

		<el-dialog
			title="护理项目"
			:visible.sync="projectVisible"
			width="1000px"
		>
			<div class="header">
				<el-button @click="searchProjectInside()">添加套餐护理项目</el-button>
				<el-button @click="openProject()">添加套餐外护理项目</el-button>
			</div>
			<br>
			<div class="planlist">
				<el-table
					:data="projectlist"
					v-loading="projectlistLoading"
				>
					<el-table-column
						show-overflow-tooltip
						label="项目名称"
						prop="nursingItemName"
					></el-table-column>
					<el-table-column label="是否收费">
						<template slot-scope="scope">
							{{ scope.row.charge ? '是' : '否'}}
						</template>
					</el-table-column>
					<el-table-column label="执行费用">
						<template slot-scope="scope">
							{{ scope.row.price }}
						</template>
					</el-table-column>
					<el-table-column label="执行周期">
						<template slot-scope="scope">
							{{ scope.row.unit == 2 ? '月' : '天'}}
						</template>
					</el-table-column>
					<el-table-column
						show-overflow-tooltip
						label="执行周期间隔"
						width="120"
						prop="cycle"
					></el-table-column>
					<el-table-column label="计划开始时间"  width="180">
						<template slot-scope="scope" v-if="scope.row.startExecTime">
							{{ scope.row.startExecTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}') }}
						</template>
					</el-table-column>
					<el-table-column label="终止时间"  width="180">
						<template slot-scope="scope" v-if="scope.row.expirationDate">
							{{ scope.row.expirationDate | parseTime('{y}-{m}-{d} {h}:{i}:{s}') }}
						</template>
					</el-table-column>
					<el-table-column label="操作" prop="disabled"  width="120px"  fixed="right">
						<template slot-scope="scope">
							<!-- <el-button type="text" @click="planVisible = true">套餐项目</el-button>
							<el-button type="text">套餐外项目</el-button>
							<el-button type="danger" @click="enablePlan(id, scope.row.state)">禁用</el-button> -->
							<el-button type="text" @click="editProject({ ...scope.row })">编辑</el-button>
							<el-button type="text" v-if="!scope.row.disabled" @click="enableProject(false, { ...scope.row })">禁用</el-button>
							<el-button type="text" v-else @click="enableProject(true, { ...scope.row })">启用</el-button>
						</template>
					</el-table-column>
				</el-table>

				<!-- <el-pagination
					:background="background"
					:current-page=projectQueryForm.currPageNo
					:total="projectTotal"
					:page-size="projectQueryForm.limit"
					@current-change="projectHandleCurrentChange"
					@size-change="projectHandleSizeChange"
				></el-pagination> -->
			</div>
		</el-dialog>

		<el-dialog
			:title="isEditProject ? '编辑套餐护理项目' : '添加套餐护理项目'"
			:visible.sync="addProjectVisibleInside"
			width="560px"
		>
			<el-form ref="addProjectFormInside" :model="addProjectFormInside" :rules="addProjectRulesInside" label-width="140px" >
        <el-form-item label="套餐类型" v-if="!isEditProject">
          <el-select v-model="typetime" placeholder="请选择"  @change="changtypetime">
            <el-option

              v-for="item in typetimes"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
				<el-form-item label="项目" prop="itemMark">

					<el-select
						:disabled="isEditProject"
						v-model="addProjectFormInside.itemMark"
						filterable
						reserve-keyword
						placeholder="请输入项目关键词">
						<el-option
							v-for="item in searchProjectOptionsInside"
							:key="item.itemMark"
							:label="item.itemName"
							:value="item.itemMark">
							<div class="itemBox">
								<span>名称：{{ item.itemName }}</span>
								<span>日护理次数：{{ item.dailyNumberOfCare }}</span>
								<span>月护理次数：{{ item.monthNumberOfCare }}</span>
								<span>总护理次数：{{ item.totalNumberOfCare }}</span>
							</div>
						</el-option>
					</el-select>
				</el-form-item>

				<el-form-item label="执行周期单位" prop="unit">
					<el-select
						v-model="addProjectFormInside.unit"
						@change="addProjectFormInside.executionTimes = [{}]"
						placeholder="请选择周期单位">
						<el-option label="月" :value="2"></el-option>
						<el-option label="天" :value="3"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="执行周期间隔数" prop="cycle">
					<el-input-number v-model="addProjectFormInside.cycle" :min="0" :max="999"></el-input-number>
				</el-form-item>
				<el-form-item label="周期内执行时间" prop="executionTimes">
					<div v-for="(item, index) in addProjectFormInside.executionTimes" class="timeBox">
						<template v-if="addProjectFormInside.unit == 2">
							<el-input-number controls-position="right" style="width:84px" v-model="item.d" :min="0" :max="31"></el-input-number> 天
						</template>
						<el-input-number controls-position="right" style="width:84px" v-model="item.h" :min="0" :max="24"></el-input-number> 时
						<el-input-number controls-position="right" style="width:84px" v-model="item.m" :min="0" :max="60"></el-input-number> 分
						<!-- <el-time-picker v-model="item.value" value-format="timestamp"></el-time-picker> -->
						<i class="el-icon-minus" v-if="index" @click="delTimeItem(index)"></i>
						<i class="el-icon-plus" v-else @click="addProjectFormInside.executionTimes.push({})"></i>
					</div>
				</el-form-item>
				<el-form-item label="计划开始时间" prop="startExecTime">
					<el-date-picker
						v-model="addProjectFormInside.startExecTime"
						type="datetime"
						placeholder="选择日期">
					</el-date-picker>
				</el-form-item>
				<el-form-item label="终止日期">
					<el-date-picker
						v-model="addProjectFormInside.expirationDate"
						type="datetime"
						placeholder="选择日期">
					</el-date-picker>
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="addProjectVisibleInside = false" >取 消</el-button>
				<el-button type="primary" @click="addProjectInside">确 定</el-button>
			</div>
		</el-dialog>

		<el-dialog
			:title="isEditProject ? '编辑套餐外护理项目' : '添加套餐外护理项目'"
			:visible.sync="addProjectVisible"
			width="560px"
		>
			<el-form ref="addProjectForm" :model="addProjectForm" :rules="addProjectRules" label-width="140px" >
        <el-form-item label="套餐类型" v-if="!isEditProject">
          <el-select v-model="typetime" placeholder="请选择"  @change="changtypetime">
            <el-option

              v-for="item in typetimes"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
				<el-form-item label="项目" prop="itemMark">
					<search-input :disabled="isEditProject" v-model="addProjectForm.itemMark" :config="sConfig" :searchName="searchName" @change="projectMarkChange2" placeholder="请输入项目关键词"></search-input>
					<!-- <search-input v-model="addProjectForm.itemMark" :config="sConfig" :searchName="searchName" :searchValue="searchValue" @change="projectMarkChange2"></search-input> -->
					<!-- <el-select
						v-model="addProjectForm.itemMark"
						filterable
						remote
						@change="projectMarkChange"
						reserve-keyword
						placeholder="请输入项目关键词"
						:remote-method="searchProject"
						:loading="searchProjectLoading">
						<el-option
							v-for="item in searchProjectOptions"
							:key="item.mark"
							:label="item.name"
							:value="item.mark">
							<div class="itemBox">
								<span style="float: left">{{ item.name }}</span>
								<span v-if="item.fee" style="float: right; color: #8492a6; font-size: 13px">价格：{{ item.fee }}</span>
							</div>
						</el-option>
					</el-select> -->
				</el-form-item>
				<div v-show="addProjectForm.itemMark">
					<el-form-item label="是否收费" prop="charged">
						{{ activeProjectlRow.charged ? '是' : '否' }}
					</el-form-item>
					<el-form-item v-show="activeProjectlRow.charged" label="执行费用" prop="price">
						<el-input-number v-model="addProjectForm.price" :min="0" :disabled="!activeProjectlRow.change"></el-input-number>
					</el-form-item>
				</div>
				<el-form-item label="执行周期单位" prop="unit">
					<el-select
						v-model="addProjectForm.unit"
						@change="addProjectForm.executionTimes = [{}]"
						placeholder="请选择周期单位">
						<el-option label="月" :value="2"></el-option>
						<el-option label="天" :value="3"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="执行周期间隔数" prop="cycle">
					<el-input-number v-model="addProjectForm.cycle" :min="0" :max="999"></el-input-number>
				</el-form-item>
				<el-form-item label="周期内执行时间" prop="executionTimes">
					<div v-for="(item, index) in addProjectForm.executionTimes" class="timeBox">
						<template v-if="addProjectForm.unit == 2">
							<el-input-number controls-position="right" style="width:84px" v-model="item.d" :min="0" :max="31"></el-input-number> 天
						</template>
						<el-input-number controls-position="right" style="width:84px" v-model="item.h" :min="0" :max="24"></el-input-number> 时
						<el-input-number controls-position="right" style="width:84px" v-model="item.m" :min="0" :max="60"></el-input-number> 分
						<!-- <el-time-picker v-model="item.value" value-format="timestamp"></el-time-picker> -->
						<i class="el-icon-minus" v-if="index" @click="delTimeItem1(index)"></i>
						<i class="el-icon-plus" v-else @click="addProjectForm.executionTimes.push({})"></i>
					</div>
				</el-form-item>
				<el-form-item label="计划开始时间" prop="startExecTime">
					<el-date-picker
						v-model="addProjectForm.startExecTime"
						type="datetime"
						placeholder="选择日期">
					</el-date-picker>
				</el-form-item>
				<el-form-item label="终止日期">
					<el-date-picker
						v-model="addProjectForm.expirationDate"
						type="datetime"
						placeholder="选择日期">
					</el-date-picker>
				</el-form-item>
			</el-form>

			<div slot="footer" class="dialog-footer">
				<el-button @click="addProjectVisible = false" >取 消</el-button>
				<el-button type="primary" @click="addProject">确 定</el-button>
			</div>
		</el-dialog>


<!--		<el-dialog-->
<!--			title="护理清单"-->
<!--			:visible.sync="carelistVisible"-->
<!--			width="1200px"-->
<!--		>-->
<!--			<div class="header">-->
<!--				<el-date-picker-->
<!--					v-model="carelistTime"-->
<!--					value-format="yyyy-MM-dd"-->
<!--					type="date"-->
<!--					style="margin-right: 10px;"-->
<!--					@change="getCarelist()"-->
<!--					placeholder="请选择日期">-->
<!--				</el-date-picker>-->
<!--				<el-button @click="generateCareListOfCheckIn">生成计划护理清单</el-button>-->
<!--				<el-button @click="openCareListItem(); addCareListItemVisible = true">添加临时护理内容</el-button>-->
<!--			</div>-->
<!--			<br>-->
<!--			<div class="planlist">-->
<!--				<el-table-->
<!--					:data="carelist"-->
<!--					v-loading="carelistLoading"-->
<!--					:row-class-name="tableRowClassName"-->
<!--				>-->
<!--					<el-table-column-->
<!--						prop="nursingItemName"-->
<!--						label="项目名称"-->
<!--					></el-table-column>-->
<!--					<el-table-column-->
<!--						width="130px"-->
<!--						prop="careTypeName"-->
<!--						label="项目类型"-->
<!--					></el-table-column>-->
<!--					<el-table-column-->
<!--						prop="execPrice"-->
<!--						label="执行价格"-->
<!--					></el-table-column>-->
<!--					<el-table-column  label="计划执行日期"  width="150">-->
<!--						<template slot-scope="scope">-->
<!--							{{scope.row.listTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}-->
<!--						</template>-->
<!--					</el-table-column>-->
<!--					<el-table-column  label="状态">-->
<!--						<template slot-scope="scope">-->
<!--							<span v-if="scope.row.disabled">已撤销</span>-->
<!--							<span v-if="scope.row.executionedTime">已执行</span>-->
<!--						</template>-->
<!--					</el-table-column>-->
<!--					<el-table-column-->
<!--						prop="executorName"-->
<!--						label="执行人"-->
<!--					></el-table-column>-->
<!--					<el-table-column  label="执行开始时间"  width="180">-->
<!--						<template slot-scope="scope" v-if="scope.row.actualExecutionTime">-->
<!--							{{scope.row.actualExecutionTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}-->
<!--						</template>-->
<!--					</el-table-column>-->
<!--					<el-table-column  label="执行结束时间"  width="180">-->
<!--						<template slot-scope="scope" v-if="scope.row.executionedTime">-->
<!--							{{scope.row.executionedTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}-->
<!--						</template>-->
<!--					</el-table-column>-->
<!--					<el-table-column-->
<!--						prop="execRemark"-->
<!--						label="执行备注"-->
<!--					></el-table-column>-->
<!--					<el-table-column label="操作" prop="disabled"  width="120px"  fixed="right">-->
<!--						<template slot-scope="scope" v-if="!scope.row.executionedTime">-->
<!--							<el-button v-if="!scope.row.disabled" type="text" @click="submitCareListVisible = true; activeCareListItem = scope.row,carray(scope.row)">执行</el-button>-->
<!--							<el-button v-if="!scope.row.disabled" type="text" @click="delCareList(scope.row)">撤销</el-button>-->
<!--						</template>-->
<!--					</el-table-column>-->
<!--				</el-table>-->

<!--				&lt;!&ndash; <el-pagination-->
<!--					:background="background"-->
<!--					:current-page=planQueryForm.currPageNo-->
<!--					:total="planTotal"-->
<!--					:page-size="planQueryForm.limit"-->
<!--					@current-change="planHandleCurrentChange"-->
<!--					@size-change="planHandleSizeChange"-->
<!--				></el-pagination> &ndash;&gt;-->
<!--			</div>-->
<!--		</el-dialog>-->
    <el-dialog
      title="生成计划清单"
      :visible.sync="carelistVisible"
      width="500px"
    >

      <div class="header">
        <span style="margin-right: 20px;">计划清单日期</span>
        <el-date-picker
          v-model="carelistTime"
          value-format="yyyy-MM-dd"
          type="date"
          style="margin-right: 10px;"

          placeholder="请选择日期">
        </el-date-picker>

      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="carelistVisible = false" >取 消</el-button>
        <el-button type="primary" @click="generateCareListOfCheckIn">确 定</el-button>
      </div>

    </el-dialog>
		<el-dialog
			title="执行护理项目"
			:visible.sync="submitCareListVisible"
			width="560px"
		>
			<el-form ref="submitCareListForm" :model="submitCareListForm" :rules="submitCareListRules" label-width="140px" >
				<el-form-item label="执行人" prop="executor">
					<search-input v-model="submitCareListForm.executor" :config="sConfig1" @change="executorChange1" placeholder="请输入执行人"></search-input>
					<!-- <el-select
						v-model="submitCareListForm.executor"
						filterable
						remote
						@change="executorChange"
						reserve-keyword
						placeholder="请输入执行人"
						:remote-method="searchexecutor"
						:loading="searchexecutorLoading">
						<el-option
							v-for="item in searchexecutorOptions"
							:key="item.number"
							:label="item.name"
							:value="item.number">
							<div class="itemBox">
								<span style="float: left">{{ item.name }}</span>
								<span style="float: right; color: #8492a6; font-size: 13px">{{ item.officeName }}</span>
							</div>
						</el-option>
					</el-select> -->
				</el-form-item>
				<el-form-item label="开始执行时间" prop="actualExecutionTime">
					<!-- value-format="yyyy-MM-dd hh:mm" -->
					<el-date-picker
						v-model="submitCareListForm.actualExecutionTime"
						type="datetime"
						placeholder="选择日期">
					</el-date-picker>
				</el-form-item>
				<el-form-item label="执行结束时间" prop="executionedTime">
					<el-date-picker
						v-model="submitCareListForm.executionedTime"
						type="datetime"
						placeholder="选择日期">
					</el-date-picker>
				</el-form-item>
        <el-form-item label="卧位" prop="lyingPosition" v-if="isturn">
          <el-select v-model="submitCareListForm.lyingPosition" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="皮肤状况" prop="skinCondition" v-if="isturn">
          <el-select v-model="submitCareListForm.skinCondition" placeholder="请选择">
            <el-option
              v-for="item in option"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
				<el-form-item label="执行内容/备注" prop="execRemark">
					<el-input
						type="textarea"
						:rows="4"
						placeholder="请输入内容"
						v-model="submitCareListForm.execRemark">
					</el-input>
				</el-form-item>
			</el-form>

			<div slot="footer" class="dialog-footer">
				<el-button @click="submitCareListVisible = false" >取 消</el-button>
				<el-button type="primary" @click="submitCareList">确 定</el-button>
			</div>
		</el-dialog>
    <el-dialog
      title="一键执行护理清单"
      :visible.sync="digsubmitoperation "
      width="800px"
    >
      <el-form ref="submitoperation" :model="submitoperation "  :rules="submitoperationRule" :inline="true" >
        <el-form-item label="执行人" prop="executor" >
          <search-input v-model="submitoperation.executor" :config="sConfig2" @change="executorChange1" placeholder="请输入执行人" style="width: 150px;"
    ></search-input>
        </el-form-item>
        <el-form-item label="清单执行日期" prop="listTime"  >
          <el-date-picker
            @change="changlisttime"
            style="width: 150px"
            v-model="submitoperation.listTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择日期">
          </el-date-picker>
        </el-form-item>

      </el-form>
      <el-table
        v-loading="carelistLoadings"
        ref="multipleTable"
        :data="tableData"
        tooltip-effect="dark"
        style="width: 100%"
        @selection-change="handleSelectionChange">
        <el-table-column
          :selectable="isDisabled"
          type="selection"
          width="55">
        </el-table-column>
        <el-table-column
          label="项目名称"
          width="120">
          <template slot-scope="scope">{{ scope.row.nursingItemName }}</template>
        </el-table-column>
        <el-table-column
          prop="careTypeName"
          label="项目类型"
          width="120">
        </el-table-column>
        <el-table-column
          prop="execPrice"
          label="执行价格"
          show-overflow-tooltip>
        </el-table-column>
        <el-table-column
          label="计划执行日期"
          show-overflow-tooltip>
          <template slot-scope="scope">
            {{scope.row.planExecutionTime | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}
          </template>
        </el-table-column>
        <el-table-column  label="状态">
          <template slot-scope="scope">
            <span v-if="scope.row.disabled">已撤销</span>
            <span v-if="scope.row.executionedTime">已执行</span>
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button @click="digsubmitoperation = false" >取 消</el-button>
        <el-button type="primary" @click="submintakeyperformCare">确 定</el-button>
      </div>
    </el-dialog>
		<el-dialog
			title="添加临时护理内容"
			:visible.sync="addCareListItemVisible"
			width="560px"
		>
			<el-form ref="addCareListItemForm" :model="addCareListItemForm" :rules="addCareListItemRules" label-width="140px" >
				<el-form-item label="项目" prop="nursingItemMark">
					<search-input v-model="addCareListItemForm.nursingItemMark" :config="sConfig" @change="projectMarkChange1" placeholder="请输入项目关键词"></search-input>
					<!-- <el-select
						v-model="addCareListItemForm.nursingItemMark"
						filterable
						remote
						@change="projectMarkChange1"
						reserve-keyword
						placeholder="请输入项目关键词"
						:remote-method="searchProject"
						:loading="searchProjectLoading">
						<el-option
							v-for="item in searchProjectOptions"
							:key="item.mark"
							:label="item.name"
							:value="item.mark">
							<div class="itemBox">
								<span style="float: left">{{ item.name }}</span>
								<span v-if="item.fee" style="float: right; color: #8492a6; font-size: 13px">价格：{{ item.fee }}</span>
							</div>
						</el-option>
					</el-select> -->
				</el-form-item>
        <el-form-item label="卧位" prop="lyingPosition" v-if="isturn">
          <el-select v-model="addCareListItemForm.lyingPosition" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="皮肤状况" prop="skinCondition" v-if="isturn">
          <el-select v-model="addCareListItemForm.skinCondition" placeholder="请选择">
            <el-option
              v-for="item in option"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
				<div v-show="addCareListItemForm.nursingItemMark">
					<el-form-item label="是否收费" prop="charged">
						{{ activeProjectlRow1.charged ? '是' : '否' }}
					</el-form-item>
					<el-form-item v-show="activeProjectlRow1.charged" label="执行费用" prop="execPrice">
						<el-input-number v-model="addCareListItemForm.execPrice" :min="0" :disabled="!activeProjectlRow1.charged"></el-input-number>
					</el-form-item>
				</div>
				<!-- <el-form-item label="护理时间" prop="listTime">
					<el-date-picker
						v-model="addCareListItemForm.listTime"
						type="date"
						value-format="yyyy-MM-dd"
						placeholder="选择日期">
					</el-date-picker>
				</el-form-item>
				<el-form-item label="计划执行时间" prop="planExecutionTime">
					<el-date-picker
						v-model="addCareListItemForm.planExecutionTime"
						type="date"
						value-format="yyyy-MM-dd"
						placeholder="选择日期">
					</el-date-picker>
				</el-form-item> -->

				<el-form-item label="执行人" prop="executor">
					<search-input v-model="addCareListItemForm.executor" :config="sConfig1" @change="executorChange1" placeholder="请输入执行人"></search-input>
					<!-- <el-select
						v-model="addCareListItemForm.executor"
						filterable
						remote
						@change="executorChange"
						reserve-keyword
						placeholder="请输入执行人"
						:remote-method="searchexecutor"
						:loading="searchexecutorLoading">
						<el-option
							v-for="item in searchexecutorOptions"
							:key="item.number"
							:label="item.name"
							:value="item.number">
							<div class="itemBox">
								<span style="float: left">{{ item.name }}</span>
								<span style="float: right; color: #8492a6; font-size: 13px">{{ item.officeName }}</span>
							</div>
						</el-option>
					</el-select> -->
				</el-form-item>
				<el-form-item label="开始执行时间" prop="actualExecutionTime">
					<!-- value-format="yyyy-MM-dd hh:mm" -->
					<el-date-picker
            :picker-options="pickerOptionsStart"
						v-model="addCareListItemForm.actualExecutionTime"
						type="datetime"
						placeholder="选择日期">
					</el-date-picker>
				</el-form-item>
				<el-form-item label="执行结束时间" prop="executionedTime">
					<el-date-picker
            :picker-options="pickerOptionsEnd"
            v-model="addCareListItemForm.executionedTime"
						type="datetime"
						placeholder="选择日期">
					</el-date-picker>
				</el-form-item>

				<el-form-item label="执行内容/备注" prop="execRemark">
					<el-input
						type="textarea"
						:rows="4"
						placeholder="请输入内容"
						v-model="addCareListItemForm.execRemark">
					</el-input>
				</el-form-item>
			</el-form>

			<div slot="footer" class="dialog-footer">
				<el-button @click="addCareListItemVisible = false" >取 消</el-button>
				<el-button type="primary" @click="addCareListItem">确 定</el-button>
			</div>
		</el-dialog>
    <el-dialog
      title="选择模板"
      :visible.sync="isPlanTemplateOfConditions"
      width="560px"
    >
      <el-form ref="TemplateOfCondition" :model="TemplateOfCondition" label-width="140px" >
        <el-form-item label="选择模板"  prop="plateOfCondition"  :rules="[
      { required: true, message: '请选择模板', trigger: 'change' },
    ]" >
      <el-select v-model="TemplateOfCondition.plateOfCondition" placeholder="请选择" >
        <el-option
          v-for="item in TemplateOfConditions"
          :key="item.templateNumber"
          :label="item.templateName"
          :value="item.templateNumber">
        </el-option>
      </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="isPlanTemplateOfConditions = false" >取 消</el-button>
        <el-button type="primary" @click="addPlanTemplateOfConditions">确 定</el-button>
      </div>
    </el-dialog>

    <el-dialog
      title="选择模板"
      :visible.sync="isPlanTemplateOfConditions"
      width="560px"
    >
      <el-form ref="TemplateOfCondition" :model="TemplateOfCondition" label-width="140px" >
        <el-form-item label="选择模板"  prop="plateOfCondition"  :rules="[
      { required: true, message: '请选择模板', trigger: 'change' },
    ]" >
          <template slot-scope="scope">
          <el-select v-model="TemplateOfCondition.plateOfCondition" placeholder="请选择"   @change="changemake">

            <el-option

              v-for="item in TemplateOfConditions"
              :key="item.id"
               :disabled=item.disabled
              :label="item.templateName"
              :value="item.templateNumber">
            </el-option>
          </el-select>
          </template>

        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="isPlanTemplateOfConditions = false" >取 消</el-button>
        <el-button type="primary" @click="addPlanTemplateOfConditions">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog :title="title" :visible.sync="outerVisible"      destroy-on-close width="1200px">



<!--      <el-form ref="form"  :model="GenerateNursePlanCreatorGenerateNursePlanCreator"   :inline="true">-->
<!--        <el-form-item label="计划名称" required>-->
<!--          <el-input v-model="GenerateNursePlanCreatorGenerateNursePlanCreator.planName"     min="0"></el-input>-->


<!--        </el-form-item>-->

<!--        <el-form-item label="执行日期" required>-->
<!--          <el-date-picker-->
<!--            v-model="GenerateNursePlanCreatorGenerateNursePlanCreator.startDate"-->
<!--            type="date"-->
<!--            value-format="yyyy-MM-dd"-->
<!--            placeholder="选择日期">-->
<!--          </el-date-picker>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="终止日期">-->
<!--          <el-date-picker-->
<!--            v-model="GenerateNursePlanCreatorGenerateNursePlanCreator.expirationDate"-->
<!--            type="date"-->
<!--            value-format="yyyy-MM-dd"-->
<!--            placeholder="选择日期">-->
<!--          </el-date-picker>-->

<!--        </el-form-item>-->

<!--      </el-form>-->


      <div class="mainBottom" >

        <prescription v-if="outerVisible" v-model="GenerateNursePlanCreatorGenerateNursePlanCreator.items" :config="config" ref="items" :marks="marks"></prescription>
      </div>


      <div slot="footer" class="dialog-footer">
        <el-button @click="outerVisible = false">取 消</el-button>
        <el-button type="primary" @click="Saveadd" v-preventReClick>确定</el-button>
      </div>
    </el-dialog>

	</div>
</template>

<script>
	import { searchCheckinInfoOfCondition,searchCarePlanTemplateContentVO,searchCarePlanTemplateOfConditions, nurseplanAdd, nurseplanUpdate, searchNursePlansOfConditions, nurseplanDisable, nurseplanEnable, nurseplanRemove, searchNursePlanItem, searchmeal, addMealItemToPlan, searchAllItemInfos, addExtraItemToPlan, modifyMealNursePlanItem, modifyExtraNursePlanItem, dailycareSearchNursePlansOfConditions, cancelCareList, disableOrEnableNursePlanItem, searchDailyCareListByOneDay, generateCareListOfCheckIn, addSnapCare, condition, searchVolunteersOfConditions, performCare,findOrganTurnOverItem,autoGenerateNursePlan,searchDailyCareListByListTime,akeydailycare } from "@/api/record"
    import prescription from './components/prescription'
	import { parseTime} from "@/utils/index";
	import searchInput from '@/components/searchInput'
  import Template from "./template";

	export default {
		name: "Record",
		filters:{
			parseTime: parseTime
		},
		components: {
        Template,
			  searchInput,prescription
		},
		data() {
			return {
          pickerOptionsStart: {
              disabledDate: time => {
                  let endDateVal = this.addCareListItemForm.executionedTime;
                  if (endDateVal) {
                      return time.getTime() > new Date(endDateVal).getTime();
                  }
              }
          },
          pickerOptionsEnd: {
              disabledDate:time => {
                let beginDateVal = this.addCareListItemForm.actualExecutionTime;
                if (beginDateVal) {
                    return (
                        time.getTime() < new Date(beginDateVal).getTime()
                    );
                }
            },
        },

          pickerOptions: {
              shortcuts: [{
                  text: '最近一周',
                  onClick(picker) {
                      const end = new Date();
                      const start = new Date();
                      start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                      picker.$emit('pick', [start, end]);
                  }
              }, {
                  text: '最近一个月',
                  onClick(picker) {
                      const end = new Date();
                      const start = new Date();
                      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                      picker.$emit('pick', [start, end]);
                  }
              }, {
                  text: '最近三个月',
                  onClick(picker) {
                      const end = new Date();
                      const start = new Date();
                      start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                      picker.$emit('pick', [start, end]);
                  }
              }]
          },
          tableData: [],
          marks:"",
          planlists:[],
          info:[],
          digsubmitoperation:false,
          dialoginfo:false,
          submitoperation:{
              checkInInMark:"",
              executor:"",
              listTime:new Date(),
              listNumber: [

              ],
          },
          typetime:1,
          showIndex:0,
          listTotal:0,
          carelistLoadings:false,
          typetimes:[
              {
                  value: 1,
                  label: '套餐内护理项目'
              }, {
                  value: 2,
                  label: '套餐外护理项目'
              },
          ],
          config: {
              column: [
                  { label: '项目名称', type: 'searchInput', key: 'markId',name:"nursingItemName",  },
                  { label: '是否收费', type: 'text', key: 'ischarge', },
                  { label: '执行费用', type: 'numbertext', key: 'price',  },
                  { label: '执行开始时间', type: 'datetime', key: 'startExecTime' },
                  { label: '执行结束时间', type: 'datetime', key: 'expirationDate' },
                  { label: '执行周期单位', type: 'select', key: 'unit' },
                  { label: '执行周期间隔数', type: 'number', key: 'cycle' },
                  { label: '周期内执行时间', type: 'texts', key: 'executionTimes' },



              ],
              data: {
                  markId:"",
                  ischarge:"",
                  price:undefined,
                  unit: undefined,
                  cycle: undefined,
                  startExecTime:undefined,
                  expirationDate:undefined,
                  executionTimes:undefined,
                  executionTime:
                      [{
                          d:undefined,
                          h:undefined,
                          m:undefined

                      }]




              },

          },
          configs:['mark','meal'],
			    mark:[

          ],
          title:"",
          outerVisible:false,
          isturn:false,
          isPlanTemplateOfConditions:false,
				sConfig: {
					api: '/sinohis/pension/fee/itemmanager/searchAllItemInfos',
					method: 'post',
					postKey: 'mnemonicCodeOrName',
					label: 'name',
					value: 'mark',
					data: { nurseItemBol: true },
					keys: [
						{ name: '名称', key: 'name' },
						{ name: '价格', key: 'fee' },
					]
				},
          plateOfCondition:"",
          TemplateOfCondition:{
              plateOfCondition:"",
          },
          TemplateOfConditions:{},

          GenerateNursePlanCreatorGenerateNursePlanCreator:

              {
                  checkInIdentify:"",
                  elderlyCode:"",//老人编号
                  expirationDate:"",//执行终止时间
                  planName:"",//计划名称
                  startDate:"",//执行开始时间
                  items:[



                  ]



              }

          ,
				sConfig1: {
					api: 'sinohis/pension/nurse/dailycare/searchExecutor',
					method: 'post',
					postKey: 'name',
					label: 'name',
					value: 'number',
					data: { institutionNumber: JSON.parse(localStorage.getItem("institutionNumber")) },
					keys: [
						{ name: '姓名', key: 'name' },
						{ name: '类型', key: 'typeName' },
					]
				},
          sConfig2: {
              api: 'sinohis/pension/nurse/dailycare/searchExecutor',
              method: 'post',
              postKey: 'name',
              label: 'name',
              value: 'number',
              data: { institutionNumber: JSON.parse(localStorage.getItem("institutionNumber")) },
              keys: [
                  { name: '姓名', key: 'name' },
                  { name: '类型', key: 'typeName' },
              ]
          },

          options:[{
            value: '1',
                label: '左'
        },
              {
                  value: '2',
                  label: '右'
              },
              {
                  value: '3',
                  label: '仰'
              },
          ],
          option:[{
              value: '1',
              label: '正常'
          },
              {
                  value: '2',
                  label: '发红'
              },
              {
                  value: '3',
                  label: '表皮破'
              },
              {
                  value: '4',
                  label: '溃烂'
              },
          ],
				searchName: '',
				searchValue: '',
				checkedInTime: '',
          listTime: [new Date(),new Date()],
				listLoading: true,
				total: 0,
				planTotal: 0,
				background: true,
				id: 0,
				list: [],
				planVisible: false,
				planIsEdit: false,
				addPlanVisible: false,
				planlist: [],
				planlistLoading: false,
				addPlanform: {},
				activeRow: {},
				projectVisible: false,
				activePlanRow: {},
				addProjectVisible: false,
          listForm: {
              currPageNo: 1,
              limit: 10,
              checkInMark: '',
              listTimeEnd: new Date(),
              listTimeStart: new Date(new Date() - 3600 * 1000 * 24 * 1) ,
          },
				queryForm: {
					currPageNo: 1,
					limit: 2,
					elderlyCode: '',
					checkedInTimeStart: '',
					checkedInTimeEnd: '',
            checkedInStatus:0
				},
				planQueryForm: {
					currPageNo: 1,
					limit: 10,
				},
				projectQueryForm: {
					// currPageNo: 1,
					// limit: 10,
				},
				projectlist: [],
				projectlistLoading: false,
				projectTotal: 0,
				addProjectValue: '',

				planRules: {
					planName: [
		            	{ required: true, message: '请输入计划名称', trigger: 'blur' },
		        	],
					startDate: [
					    { required: true, message: '请选择执行日期', trigger: 'change' }
					],
				},
				searchProjectLoading: false,
				searchProjectOptions: [],
				addProjectForm: {},
				addProjectRules: {
					itemMark: [
					    { required: true, message: '请选择项目', trigger: 'change' }
					],
					unit: [
					    { required: true, message: '请选择执行周期单位', trigger: 'change' }
					],
					cycle: [
					    { required: true, message: '请输入间隔数', trigger: 'change' }
					],
					executionTimes: [
					    { type: 'array', required: true, message: '请选择周期内执行时间', trigger: 'change' }
					],
					startExecTime: [
					    { required: true, message: '请选择开始时间', trigger: 'change' }
					],
				},
				addProjectVisible: false,
				addProjectVisibleInside: false,
				searchProjectOptionsInside: [],
				addProjectFormInside: {
					executionTimes: []
				},
				addProjectRulesInside: {
					itemMark: [
					    { required: true, message: '请选择项目', trigger: 'change' }
					],
					unit: [
					    { required: true, message: '请选择执行周期单位', trigger: 'change' }
					],
					cycle: [
					    { required: true, message: '请输入间隔数', trigger: 'change' }
					],
					executionTimes: [
					    { type: 'array', required: true, message: '请选择周期内执行时间', trigger: 'change' }
					],
					startExecTime: [
					    { required: true, message: '请选择开始时间', trigger: 'change' }
					],
				},
				activeProjectlRow: {},
				activeProjectlRow1: {},
				isEditProject: false,

				carelistVisible: false,
				carelist: [],
				carelistLoading: false,


				submitCareListVisible: false,
				submitCareListForm: {},
				submitCareListRules: {
					executor: [
					    { required: true, message: '请选择执行人', trigger: 'change' }
					],
					actualExecutionTime: [
					    { required: true, message: '请选择开始时间', trigger: 'change' }
					],
					executionedTime: [
					    { required: true, message: '请选择结束时间', trigger: 'change' }
					]
				},

          submitoperationRule: {
              executor: [
                  { required: true, message: '请选择执行人', trigger: 'change' }
              ],
              listTime: [
                  { required: true, message: '请选择清单日期', trigger: 'change' }
              ],

          },
          PlanTemplateOfConditionss:{
              currPageNo: 1,
              limit: 99999,
              packageMark:"",
          },
          checkedInStatuss:[
              { label: '全部', value: 2, },
              { label: '入住中', value: 0, },
              { label: '已退住', value: 1, },


          ],

				carelistTime: parseTime(new Date(), '{y}-{m}-{d}'),
				addCareListItemVisible: false,
				addCareListItemForm: {},

				addCareListItemRules: {
					nursingItemMark: [
					    { required: true, message: '请选择项目', trigger: 'change' }
					],
					execPrice: [
					    { required: true, message: '请输入执行费用，可以为0', trigger: 'change' }
					],
					listTime: [
					    { required: true, message: '请选择护理时间', trigger: 'change' }
					],
					planExecutionTime: [
					    { required: true, message: '请选择计划执行时间', trigger: 'change' }
					],
					executor: [
					    { required: true, message: '请选择执行人', trigger: 'change' }
					],
					actualExecutionTime: [
					    { required: true, message: '请选择开始执行时间', trigger: 'change' }
					],
					executionedTime: [
					    { required: true, message: '请选择执行结束时间', trigger: 'change' }
					],
				},
				searchexecutorLoading: false,
				searchexecutorOptions: [],
				activeCareListItem: {},
				executorType: '',

			};
		},
		created(){

			this.queryForm.institutionNumber= JSON.parse(localStorage.getItem("institutionNumber"));
			 this.search()



		},
      mounted(){

          setTimeout(() => {

              if(this.list){
                  this.activeRow.checkInMark=this.list[0].checkInMark
                  this.listForm.checkInMark= this.list[0].checkInMark
                  this.searchDailyCareListByListTime()
              }

          }, 1000);

      },
		methods: {
			search(id){
				this.listLoading = true;
				if(id==0){

				    this.queryForm.currPageNo=1
        }else if(id==1){
            this.queryForm.currPageNo=1
            this.showIndex=0
        }


				searchCheckinInfoOfCondition(this.queryForm).then(res =>{

                    this.list = res.data.data
                    this.total = res.data.total
            if(res.data.data){

                this.listForm.checkInMark= res.data.data[0].checkInMark
                this.activeRow.checkInMark=res.data.data[0].checkInMark
                searchDailyCareListByListTime(this.listForm).then(res => {
                    this.listTotal=res.data.total

                    this.carelist = res.data.data
                    // this.carelist = [{}]
                    setTimeout(() => {
                        this.carelistLoading = false;
                    }, 50);
                })
            }else {
                this.listTotal=0
                this.carelist=[]
            }


            setTimeout(() => {
                        this.listLoading = false;
                    }, 50);
                })
			},
        getList(val){
			    console.log(val.checkInMark)
              this.listForm.checkInMark=val.checkInMark
            this.searchDailyCareListByListTime()

        },
        changemake(value){

            let obj = {};
            obj = this.TemplateOfConditions.find((item)=>{
                console.log(item)
                 return item.templateNumber === value;
            });
            let packageMark = ''
            packageMark = obj.packageMark;
            console.log(packageMark)
            this.title=obj.templateName+'计划'
            this.GenerateNursePlanCreatorGenerateNursePlanCreator.planName=obj.templateName
            this.marks=packageMark
        },
        changtypetime(value){
			     console.log(value)
            if(value==2){

                this.addProjectVisible=true
                this.addProjectVisibleInside=false
            }else {
                this.addProjectVisibleInside=true
                this.addProjectVisible=false
            }
        },
        //一键执行
        akeyperformCare(){
            this.Echo()
            this.carelistLoadings = true

          this.submitoperation.listTime=new Date()
            this.searchDailyCareListByOneDay()

        },
        Echo(){
            if(this.tableData){
                this.$nextTick(()=>{
                    this.tableData.forEach(row => {
                        console.log(row.executionedTime)
                        if(row.executionedTime==null){
                            this.$refs.multipleTable.toggleRowSelection(row,true);
                        }
                        // this.$refs.multipleTable.toggleRowSelection(row,true);



                    })


                })

            }
        },
        searchDailyCareListByOneDay(){
            searchDailyCareListByOneDay({ listTime: this.submitoperation.listTime, checkInMark: this.activeRow.checkInMark }).then(res => {

                this.tableData = res.data
                 this.Echo()
                setTimeout(() => {
                    this.carelistLoadings = false;
                }, 50);
            })
        },
        searchinfo(row){
			     console.log(row)
            this.info=row
        },
        submintakeyperformCare(){
            this.submitoperation.checkInInMark = this.activeRow.checkInMark
            this.submitoperation.executorType = this.executorType
            console.log(this.submitoperation)
            this.$refs['submitoperation'].validate((valid) => {
                if (valid) {
                    akeydailycare(this.submitoperation).then(res => {
                        console.log(res)
                        this.$baseMessage("操作成功",'success');
                        this.listForm.listTimeEnd= this.submitoperation.listTime
                        this.listForm.listTimeStart= this.submitoperation.listTime

                        let carelistTimestart=this.submitoperation.listTime
                        this.listTime=[ this.submitoperation.listTime,carelistTimestart]
                        this.carelistLoadings=false
                        this.digsubmitoperation=false
                        this.searchDailyCareListByListTime()


                    })
                }

            })


        },
        handleSelectionChange(val) {
            this.submitoperation.listNumber=[]
            for(let i=0;i<val.length;i++){
                this.submitoperation.listNumber.push(val[i].listNumber)
            }

        },
        changlisttime(value){
            this.submitoperation.listTime=value
            this.searchDailyCareListByOneDay()

        },
        isDisabled(row,index){

            if(row.executionedTime==null ){
                if(row.disabled==false ){

                    return 1
                }else {
                    return 0
                }
                return 1
            }else {
                return 0
            }




        },
        //
        addPlanTemplateOfConditions(){
            this.$refs['TemplateOfCondition'].validate((valid) => {
                if (valid) {

                    console.log()
                    let templateNumber=this.TemplateOfCondition.plateOfCondition
                    let checkInMark=this.activeRow.checkInMark

                    searchCarePlanTemplateContentVO({templateNumber,checkInMark}).then(res =>{
                        console.log(res.data)

                          res.data.forEach(item => {
                                 if(item.charge==false){
                                     item.ischarge="否"

                                 }else if(item.charge==true) {
                                     item.ischarge="是"

                                 }
                                 console.log(item.mealItem,)
                                  item.markId =item.nursingItemMark+ item.mealItem


                          })


                            this.GenerateNursePlanCreatorGenerateNursePlanCreator.items=res.data


                        this.$nextTick(function () {

                            this.$refs.items.parentHandleclick(this.GenerateNursePlanCreatorGenerateNursePlanCreator.items)
                        })


                    })

                     this.isPlanTemplateOfConditions=false
                     this.outerVisible=true

                } else {

                    return false;
                }
            });
        },
        PlanTemplateOfConditions(){
			      // this.GenerateNursePlanCreatorGenerateNursePlanCreator.expirationDate=""
            // this.GenerateNursePlanCreatorGenerateNursePlanCreator.startDate=""
            // this.GenerateNursePlanCreatorGenerateNursePlanCreator.planName=""
            // this.GenerateNursePlanCreatorGenerateNursePlanCreator={
            //
            //
            //
            //             checkInIdentify:"",
            //             elderlyCode:"",//老人编号
            //             expirationDate:"",//执行终止时间
            //             planName:"",//计划名称
            //             startDate:"",//执行开始时间
            //             items:[
            //
            //
            //
            //             ]
            //
            //
            //
            //
            // }

                 let PlanTemplateOfConditions=this.PlanTemplateOfConditionss
            searchCarePlanTemplateOfConditions(PlanTemplateOfConditions).then(res =>{

                this.TemplateOfConditions=res.data.data
                console.log(res.data.data)
                // if( this.TemplateOfConditions.length==1){
                //
                //      this.title=res.data.data[0].templateName+'计划'
                //      this.GenerateNursePlanCreatorGenerateNursePlanCreator.planName=res.data.data[0].templateName
                //
                //     let templateNumber=res.data.data[0].templateNumber
                //     let checkInMark=this.activeRow.checkInMark
                //
                //     console.log(templateNumber)
                //     searchCarePlanTemplateContentVO({templateNumber,checkInMark}).then(res =>{
                //         console.log(res.data)
                //
                //         res.data.forEach(item => {
                //             if(item.charge==false){
                //                 item.ischarge="否"
                //
                //             }else if(item.charge==true) {
                //                 item.ischarge="是"
                //
                //             }
                //             item.markId =item.nursingItemMark+ (item.mealItem)
                //
                //
                //
                //         })
                //
                //
                //         this.GenerateNursePlanCreatorGenerateNursePlanCreator.items=res.data
                //
                //
                //         this.$nextTick(function () {
                //             this.$refs.items.parentHandleclick(this.GenerateNursePlanCreatorGenerateNursePlanCreator.items)
                //         })
                //
                //
                //     })
                //
                //
                //     this.outerVisible=true
                //
                //
                // }else {
                //
                //     this.isPlanTemplateOfConditions=true
                // }

            })

            this.isPlanTemplateOfConditions=true










        },

        Saveadd(){
            var aData = new Date();
            this.GenerateNursePlanCreatorGenerateNursePlanCreator.startDate= aData

            for (let i=0;i<this.GenerateNursePlanCreatorGenerateNursePlanCreator.items.length;i++){
                this.GenerateNursePlanCreatorGenerateNursePlanCreator.items[i].templateNumber=this.TemplateOfCondition.plateOfCondition



            }

          autoGenerateNursePlan(this.GenerateNursePlanCreatorGenerateNursePlanCreator).then(res =>{
                      if(res.code==200){
                          this.$baseMessage("设置成功");
                          this.getPlanlist()
                          this.outerVisible=false
                      }
          })

        },
			handleSizeChange(val) {
				this.queryForm.limit = val;
				this.search();
			},
			handleCurrentChange(val) {
			   this.showIndex=0

				this.queryForm.currPageNo = val;
				this.search();

          setTimeout(() => {
              console.log(this.list[0].checkInMark)
              if(this.list){
                  this.activeRow.checkInMark=this.list[0].checkInMark
                  this.listForm.checkInMark= this.list[0].checkInMark
                  this.searchDailyCareListByListTime()
              }

          }, 1000);

      },
			planHandleSizeChange(val) {
				this.planQueryForm.limit = val;
				this.getPlanlist();
			},
			planHandleCurrentChange(val) {
				this.planQueryForm.currPageNo = val;
				this.getPlanlist();
			},
        listHandleSizeChange(val) {
            this.listForm.limit = val;
            this.searchDailyCareListByListTime();
        },
        listHandleCurrentChange(val) {
            this.listForm.currPageNo = val;
            this.searchDailyCareListByListTime();
        },
			projectHandleSizeChange(val) {
				this.planQueryForm.limit = val;
				this.getProjectlist();
			},
			projectHandleCurrentChange(val) {
				this.planQueryForm.currPageNo = val;
				this.getProjectlist();
			},
			close(){
				this.dialogFormVisible = false;
			},
			getPlanlist(row){
			      this.TemplateOfCondition.plateOfCondition=''
           this.PlanTemplateOfConditionss.packageMark=this.activeRow.mealCode
          this.GenerateNursePlanCreatorGenerateNursePlanCreator.checkInIdentify=this.activeRow.checkInMark

          this.GenerateNursePlanCreatorGenerateNursePlanCreator.elderlyCode=this.activeRow.elderlyCode
				this.planlistLoading = true
				this.planQueryForm.checkInMark = this.activeRow.checkInMark
				searchNursePlansOfConditions(this.planQueryForm).then((res) => {

					        this.planlist = res.data.data || []
	                this.planTotal = res.data.total
            // for(let i=0;i<res.data.data.length;i++){
            //     console.log(res.data.data[i].items)
            //     for(let j=0;j<res.data.data[i].items.length;j++){
            //         console.log(res.data.data[i].items[j].executionTimes)
            //         let a = res.data.data[i].items[j].executionTimes
            //         console.log(a)
            //         a = a.substring(0, a.length - 1)
            //         a = a.split('&')
            //         let c = []
            //         a.forEach(item => {
            //             let b = {}
            //             let d = item.split('-')
            //             b.d = parseInt(d[0])
            //             b.h = parseInt(d[1])
            //             b.m = parseInt(d[2])
            //             c.push(b)
            //         })
            //
            //
            //         this.planlist[i].items[j].executionTimes=c
            //     }
            // }
	                setTimeout(() => {
	                    this.planlistLoading = false;
	                }, 50);
				})
          console.log(row)

			},
			savePlan(){
				this.$refs['addPlanform'].validate(async (valid) => {
                    if (valid) {
                    	this.addPlanform.checkInIdentify = this.activeRow.checkInMark
                    	if(this.planIsEdit){
                    		nurseplanUpdate(this.addPlanform).then(res => {
                    			this.addPlanVisible = false
                    			this.getPlanlist()
                    		})
                    	}else{
                    		nurseplanAdd(this.addPlanform).then(res => {
                    			this.addPlanVisible = false
                    			this.planQueryForm.currPageNo = 1
                    			this.getPlanlist()
                    		})
                    	}
                    }
                })
			},
			enablePlan(planNumber, state){
				if(!state){
					nurseplanDisable({planNumber}).then(res => {
						this.getPlanlist()
					})
				}else{
					nurseplanEnable({planNumber}).then(res => {
						this.getPlanlist()
					})
				}
			},
			delPlan(planNumber){
				this.$baseConfirm("你确定要删除当前项吗", null, async () => {
					const {code, msg } = await nurseplanRemove({planNumber});
					if(code==200){
						this.$baseMessage("删除成功");
						this.getPlanlist()
					}else {
						this.$baseMessage("删除失败");
					}
				});
			},
			getProjectlist(type){
				this.projectlistLoading = true
				this.projectQueryForm.planNumber = this.activePlanRow.planNumber
				searchNursePlanItem(this.projectQueryForm).then((res) => {
					this.projectlist = res.data
	                // this.projectTotal = res.data.total
	                setTimeout(() => {
	                    this.projectlistLoading = false;
	                }, 50);
				})
			},
			addProject(){
				this.$refs['addProjectForm'].validate(async (valid) => {
                    if (valid) {
                    	let times = [...this.addProjectForm.executionTimes]
                    	let timeList = []
                    	let timeString = []
                    	for(let i=0; i<times.length; i++){
                    		let item = times[i]
                    		let itemList = []
                    		itemList.push(item.d >= 0 ? item.d : 0)
                    		itemList.push(item.h >= 0 ? item.h : 0)
                    		itemList.push(item.m >= 0 ? item.m : 0)
                    		timeList.push(itemList)
                    		let timeStringItem = (item.d >= 0 ? item.d : 0) + '' + item.h + '' + item.m

                    		if(timeStringItem.length > 6){
                    			this.$baseMessage('执行时间不能为空', 'error')
                    			return false
                    		}
                    		timeString.push(timeStringItem)
                    	}
                    	if(Array.from(new Set(timeString)).length < timeString.length){
                    		this.$baseMessage('执行时间不能重复', 'error')
                    		return false
                    	}
                    	let addForm = {...this.addProjectForm}
                    	addForm.executionTimes = timeList
                    	// addForm.mealMark = this.activeRow.mealCode
                    	addForm.planNumber = this.activePlanRow.planNumber

                    	if(this.isEditProject){
                    		modifyExtraNursePlanItem(addForm).then(res => {
                    			this.getPlanlist()
                    			this.addProjectVisible = false
                    		})
                    	}else{
                    		addExtraItemToPlan(addForm).then(res => {
	                    		this.getPlanlist()
	                    		this.addProjectVisible = false
	                    	})
                    	}

                    }
                })
			},
			addProjectInside(){
				// this.isEditProject = false
				this.$refs['addProjectFormInside'].validate(async (valid) => {
                    if (valid) {
                    	let times = [...this.addProjectFormInside.executionTimes]
                    	let timeList = []
                    	let timeString = []
                    	for(let i=0; i<times.length; i++){
                    		let item = times[i]
                    		let itemList = []
                    		itemList.push(item.d >= 0 ? item.d : 0)
                    		itemList.push(item.h >= 0 ? item.h : 0)
                    		itemList.push(item.m >= 0 ? item.m : 0)
                    		timeList.push(itemList)
                    		let timeStringItem = (item.d >= 0 ? item.d : 0) + '' + item.h + '' + item.m

                    		if(timeStringItem.length > 6){
                    			this.$baseMessage('执行时间不能为空', 'error')
                    			return false
                    		}
                    		timeString.push(timeStringItem)
                    	}
                    	if(Array.from(new Set(timeString)).length < timeString.length){
                    		this.$baseMessage('执行时间不能重复', 'error')
                    		return false
                    	}
                    	let addForm = {...this.addProjectFormInside}
                    	addForm.executionTimes = timeList
                    	addForm.mealMark = this.activeRow.mealCode
                    	addForm.planNumber = this.activePlanRow.planNumber
                    	if(this.isEditProject){
                    		modifyMealNursePlanItem(addForm).then(res => {
                    			this.getPlanlist()
                    			this.addProjectVisibleInside = false
                    		})
                    	}else{
                    		addMealItemToPlan(addForm).then(res => {
                    			this.getPlanlist()
                    			this.addProjectVisibleInside = false
                    		})
                    	}
                    }
                })
			},
			searchProjectInside(){
         this.typetime=1
          this.addProjectForm = {
              executionTimes: [{value: ''}]
          }
				this.isEditProject = false
				searchmeal({ checkInMark: this.activeRow.checkInMark }).then(res => {
					this.searchProjectOptionsInside = res.data.items
				})
				this.addProjectVisibleInside = true;
				this.addProjectFormInside = {
					executionTimes: [{}]
				}
				this.$nextTick(() => {
					this.$refs['addProjectFormInside'].clearValidate();
            this.$refs['addProjectForm'].clearValidate();
				})
			},
			openProject(){
				this.searchName = ''
				this.addProjectVisible = true
				this.isEditProject = false
				this.addProjectForm = {
					executionTimes: [{value: ''}]
				}
				this.$nextTick(() => {
					this.$refs['addProjectForm'].clearValidate();
				})
			},
			searchProject(mnemonicCodeOrName) {
				// this.addProjectVisible = true
				if (mnemonicCodeOrName !== '') {
					this.searchProjectLoading = true;
					searchAllItemInfos({ mnemonicCodeOrName: mnemonicCodeOrName, nurseItemBol: true }).then(res => {
						this.searchProjectLoading = false;
						this.searchProjectOptions = res.data
					})
				} else {
					this.searchProjectOptions = [];
				}
			},
			delTimeItem(index){
				this.addProjectFormInside.executionTimes.splice(index, 1)
			},
			delTimeItem1(index){
				this.addProjectForm.executionTimes.splice(index, 1)
			},
			projectMarkChange(val){
				this.activeProjectlRow = this.searchProjectOptions.find(item => item.mark === val)
				this.addProjectForm.price = this.activeProjectlRow.fee
				this.addProjectForm.charge = this.activeProjectlRow.charged
			},
			projectMarkChange2(row){
				this.activeProjectlRow = row
				this.searchName = row.name
				this.addProjectForm.price = this.activeProjectlRow.fee
				this.addProjectForm.charge = this.activeProjectlRow.charged
			},
			projectMarkChange1(row){




				this.activeProjectlRow1 = row
				this.addCareListItemForm.execPrice = this.activeProjectlRow1.fee

          if(this.mark==row.mark){
      this.isturn=true
              return false
          }else {
              this.isturn=false
          }

          if(this.mark){

              for(let i=0;i<this.mark.length;i++){
                  console.log(this.mark[i])

                  if(this.mark[i]==row.mark){
                      this.$set(this.addCareListItemForm,'lyingPosition','1')
                      this.$set(this.addCareListItemForm,'skinCondition','1')
                      this.isturn=true
                      return false
                  }else {
                      this.$set(this.addCareListItemForm,'lyingPosition','')
                      this.$set(this.addCareListItemForm,'skinCondition','')
                      this.isturn=false
                  }
              }
          }else {

          }


      },
        carray(row){
			    this.findOrganTurnOverItem()

            var dateee = new Date(row.planExecutionTime).toJSON();
            let time= new Date (+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
            let times=(time.substring(0, 10));
            this.listForm.listTimeStart= (times)
            this.listForm.listTimeEnd= (times)

            if(this.mark){
                for(let i=0;i<this.mark.length;i++){
                    console.log(this.mark[i])

                    if(this.mark[i]==row.nursingItemMark){
                        this.isturn=true
                        return false
                    }else {
                        this.isturn=false
                    }
                }

            }else {

            }

        },
			editProject(row){
			    console.log(row)
				this.isEditProject = true

				let isInside = row.mealItem

				if(isInside){
					searchmeal({ checkInMark: this.activeRow.checkInMark }).then(res => {
						this.searchProjectOptionsInside = res.data.items
					})
					this.addProjectVisibleInside = true;
				}else{
					// this.searchProject(row.nursingItemName)
					this.searchName = row.nursingItemName
					this.searchValue = row.nursingItemMark
					this.addProjectVisible = true;
				}

				let a = row.executionTimes
          console.log(a)
				a = a.substring(0, a.length - 1)
				a = a.split('&')
				let c = []
				a.forEach(item => {
              let b = {}
              let d = item.split('-')
              b.d = parseInt(d[0])
              b.h = parseInt(d[1])
              b.m = parseInt(d[2])
              c.push(b)
          })
          console.log(c)
				row.executionTimes = c
				row.itemMark = row.nursingItemMark

				if(isInside){
					this.addProjectFormInside = row
				}else{
					this.addProjectForm = row
				}
			},
			enableProject(type, row){
				let isInside = row.mealItem
				disableOrEnableNursePlanItem({ enableStatus: type, planItemNumber: row.planItemNumber }).then(res => {
					this.getPlanlist()
				})
			},
        searchDailyCareListByListTime(){

            searchDailyCareListByListTime(this.listForm).then(res => {
               console.log(this.listForm)
                this.listTotal=res.data.total
                this.carelist = res.data.data

                setTimeout(() => {
                    this.carelistLoading = false;
                }, 50);
            })

        },
			getCarelist(){
				this.carelistLoading = true
          searchDailyCareListByOneDay({ listTime: this.carelistTime, checkInMark: this.activeRow.checkInMark }).then(res => {
					this.carelist = res.data
					// this.carelist = [{}]
					setTimeout(() => {
	                    this.carelistLoading = false;
	                }, 50);
				})
			},
			delCareList(row){
				this.$baseConfirm("你确定要撤销当前项吗", null, async () => {
					const {code, msg } = await cancelCareList({ checkInMark: this.activeRow.checkInMark, listNumber: row.listNumber, listTime: row.listTime });
					if(code==200){
						this.$baseMessage("撤销成功");
              this.searchDailyCareListByListTime()
					}else {
						this.$baseMessage("撤销失败");
					}
				});
			},
			submitCareList(){
			    this.listForm.currPageNo=1
				this.$refs['submitCareListForm'].validate(async (valid) => {
					if(valid){
						this.submitCareListForm.listNumber = this.activeCareListItem.listNumber
						this.submitCareListForm.checkInInMark = this.activeRow.checkInMark
						this.submitCareListForm.listTime = this.activeCareListItem.listTime
						this.submitCareListForm.executorType = this.executorType

						console.log(this.submitCareListForm)
              this.searchDailyCareListByListTime()

              performCare(this.submitCareListForm).then(res => {
							// this.getCarelist()

                 this.listTime=[  this.listForm.listTimeStart, this.listForm.listTimeEnd]
                this.searchDailyCareListByListTime()
							this.submitCareListVisible = false;
							this.submitCareListForm = {}
							this.$nextTick(() => {
								this.$refs['submitCareListForm'].clearValidate();
							})
						})
					}
				})
			},
        openListOfCheckIn(){
                this.carelistVisible=true
        },
			generateCareListOfCheckIn(){
				if(this.carelistTime){
					this.$baseConfirm("该操作会覆盖已生成的护理清单，确认继续吗", null, async () => {
						generateCareListOfCheckIn( { listTime: this.carelistTime, checkInMark: this.activeRow.checkInMark } ).then(res => {
							this.$baseMessage("生成成功", 'success');
							this.carelistVisible=false
                this.listTotal=0
                 // this.getCarelist()

                this.listForm.listTimeEnd= this.carelistTime
                this.listForm.listTimeStart= this.carelistTime

                let carelistTimestart=this.carelistTime
                this.listTime=[ this.carelistTime,carelistTimestart]
                this.searchDailyCareListByListTime()

                console.log(this.listTime)
						})
					});
				}else{
					this.$baseMessage("请选择日期", 'error');
				}
			},
			addCareListItem(){
				this.addCareListItemForm.checkInMark = this.activeRow.checkInMark
				this.addCareListItemForm.executorType = this.executorType
				this.addCareListItemForm.planExecutionTime = this.addCareListItemForm.actualExecutionTime
				// this.addCareListItemForm.listTime = this.carelistTime
				console.log(this.addCareListItemForm)
				this.$refs['addCareListItemForm'].validate(async (valid) => {
					if (valid) {
						addSnapCare(this.addCareListItemForm).then(res => {
							this.$baseMessage("添加成功", 'success');
                this.listForm.listTimeEnd= this.addCareListItemForm.actualExecutionTime
                this.listForm.listTimeStart= this.addCareListItemForm.actualExecutionTime
                this.listTime=[ this.addCareListItemForm.actualExecutionTime,this.addCareListItemForm.actualExecutionTime]
                this.searchDailyCareListByListTime()


                // this.getCarelist()

							this.addCareListItemVisible = false
						})
					}
				})
			},
        findOrganTurnOverItem(){
            let institutionNumber=this.queryForm.institutionNumber
            findOrganTurnOverItem({institutionNumber}).then(res =>{
                 console.log(res)
                 this.mark=res.data
            })
        },
			openCareListItem(){
			    this.isturn=false
			   this.findOrganTurnOverItem()

				this.addCareListItemForm = {}
				this.$nextTick(() => {
					this.$refs['addCareListItemForm'].clearValidate();
				})
			},
			async searchexecutor(name) {
				// this.addProjectVisible = true
				if (name !== '') {
					this.searchexecutorLoading = true;
					const res1 = await condition({ currPageNo: 1, limit: 99999, name })
					const res2 = await searchVolunteersOfConditions({ currPageNo: 1, limit: 99999, name })
					let list1 = res1.data.data || []
					let list2 = res2.data.data || []
					list1 = list1.concat(list2)
					this.searchexecutorLoading = false;
					this.searchexecutorOptions = list1
				} else {
					this.searchexecutorOptions = [];
				}
			},
			executorChange(val){
				this.executorType = this.searchexecutorOptions.find(item => item.number === val).office
			},
			executorChange1(row){
				this.executorType = row.type
			},
			tableRowClassName({row, rowIndex}) {
				if (row.disabled) {
					return 'warning-row';
				} else if (row.executionedTime) {
					return 'success-row';
				}
				return '';
			}
		},
		watch: {
			// addPlanVisible: function(val){
			// 	!val && (this.addPlanform = {})
			// },
			// addProjectVisibleInside: function(val){
			// 	if(val){
			// 		// this.addProjectFormInside.executionTimes = [{value: ''}]
			// 	}else{
			// 		this.addProjectFormInside = {}
			// 		this.addProjectFormInside.executionTimes = [{value: ''}]
			// 	}
			// }
		}
	}
</script>

<style scoped>
	.timeBox{margin-bottom: 10px;}
	.timeBox:last-child{margin-bottom: 0;}
	.timeBox i{cursor: pointer;color: #1890ff;margin-left: 10px;}
	.itemBox{}
	.itemBox span{display: inline-block;overflow: hidden; white-space: nowrap; text-overflow: ellipsis;width: 120px;}
	.itemBox span:first-child{width: 130px;}

	.table-mechanism >>> .el-table .warning-row {background: oldlace;opacity: 0.5;}
	.table-mechanism >>> .el-table .success-row {background: #f0f9eb;}
	.tableHeader{padding:20px 10px;}

  .screenBox >>> .el-form-item__label-wrap{}
  .treeTable{overflow: hidden;}
  .menuBox{float: left;min-width: 380px;margin-top: 20px;height: calc(100vh - 330px);overflow: auto; border: 1px solid #ddd;padding: 4px}
  .tableBox{padding-top: 20px;margin-left: 430px;}
  .footerBtns{text-align: right;}
  .treeTable >>> .el-table th{background: #f2f2f2;border-bottom: 0;line-height: 30px;}
  .treeTable >>> .el-table th .cell{color: #000;font-weight: 500;}
  .treeTable >>> .el-table td{border-color: #e5e5e5;}
  .screenBox{margin-bottom: 0;}

  .menuBox ul{background: #fff;margin-bottom: 30px;}
  .menuBox li{line-height: 40px;padding-left: 20px;transition: all 0.4s;border-bottom: 1px solid #f2f2f2;font-size: 14px;}
  .menuBox li:hover{background: #ccc;cursor: pointer;border-color: #ccc;}
  .menuBox li.active{background: #4c6ca7;cursor: pointer;color: #fff;border-color: #4c6ca7;}
  .menuBox li b{margin-right: 20px;display: inline-block;width: 60px;}

  .menuBox .el-button-group{padding: 20px;margin-right: 26px;}
  .userInfo{height: 38px;margin-bottom: 14px;border: 1px solid #dfe6ec;padding: 8px 20px;position: relative;}
  .userInfo p{text-align: center;line-height: 66px;font-size: 12px;color: #909399;}
  .userInfo ul{max-width: 1000px;}
  .userInfo ul li{display: inline-block;font-size: 14px;line-height: 22px;}
  .userInfo ul li:nth-child(1){width: 25%;}
  .userInfo ul li:nth-child(2){width: 35%;}
  .userInfo ul li:nth-child(3){width: 35%;}
  .userInfo ul li:nth-child(4){width: 25%;}
  .userInfo ul li:nth-child(5){width: 70%;}
  .userInfo ul li:nth-child(6){width: 25%;}
  .userInfo ul li:nth-child(7){width: 35%;}
  .userInfo ul li:nth-child(8){width: 35%;}
  .menuBoxul ul  li, dl, dt, dd, ul, ol {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  .footerBtns >>> .el-dropdown .el-button{margin-right: 10px;}
  .footerBtns >>> .el-dropdown .el-button .el-icon--right{height: 0;}
  .userInfo i{position: absolute;right: 12px;top: 12px;cursor: pointer;}
  .screen .el-date-editor.el-input__inner {
    width: 160px;
    padding-right: 0;
    padding-left: 5px;
  }
  table
  {
    border-collapse: collapse;
    margin: 0 auto;
    text-align: center;
  }
  table td, table th
  {
    border: 1px solid #cad9ea;
    height: 30px;
  }
  table .ttitle
  {
    background-color: #F5FAFA;
    width: 100px;
  }
  table tr:nth-child(odd)
  {
    background: #fff;
  }
</style>
